home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.1 / card_11791.txt < prev    next >
Text File  |  1989-02-26  |  3KB  |  122 lines

  1. -- card: 11791 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3837
  5. -- name: DeleteFile
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: A003
  11. -- rect: left=82 top=302 right=324 bottom=182
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Install
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   if the optionkey is down then pass mouseup
  23.   put installres(XFCN,DeleteFile) into it
  24.   if it is empty then play oops
  25.   else answer it
  26. end mouseUp
  27.  
  28.  
  29.  
  30. -- part 2 (button)
  31. -- low flags: 00
  32. -- high flags: A004
  33. -- rect: left=224 top=241 right=292 bottom=283
  34. -- title width / last selected line: 0
  35. -- icon id / first selected line: 27056 / 27056
  36. -- text alignment: 1
  37. -- font id: 0
  38. -- text size: 12
  39. -- style flags: 0
  40. -- line height: 16
  41. -- part name: Try It
  42. ----- HyperTalk script -----
  43. --
  44. --12/15/87  ‚Ä¢‚Ä¢‚Ä¢Steve Drazga‚Ä¢‚Ä¢‚Ä¢
  45. --
  46. --This script needs XFCNs 'FilenName' and 'DeleteFile'
  47. --It also uses the HyperTalk function 'OsErr'
  48. --
  49. on mouseUp
  50.   if the optionkey is down then pass mouseup
  51.   put "Please select a file to delete"
  52.   put filename() into deletethis
  53.   if deletethis is empty then
  54.     hide message window
  55.     play oops
  56.     exit mouseup
  57.   end if
  58.   hide message window
  59.  
  60.   answer "Are you sure you want to delete this?" with "Cancel" or "OK"
  61.   if it is "Cancel" then
  62.     play oops
  63.     exit mouseup
  64.   end if
  65.  
  66.   put deletefile(deletethis) into returnedthis
  67.  
  68.   if returnedthis = 0 then
  69.     answer "I hope you were sure, 'cause it's gone!"
  70.   else
  71.     if returnedthis < 0 then
  72.       OsErr returnedthis
  73.     else
  74.       play oops
  75.       answer "Whoops, there was an error"
  76.     end if
  77.   end if
  78.  
  79. end mouseUp
  80.  
  81.  
  82.  
  83. -- part contents for background part 5
  84. ----- text -----
  85. DeleteFile
  86.  
  87. -- part contents for background part 10
  88. ----- text -----
  89. 9
  90.  
  91. -- part contents for background part 6
  92. ----- text -----
  93.  
  94. This will delete the specified file from the disk.  Be careful, there's no turning back.
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101. Thanks to:
  102. Dewi Williams
  103. 2227 Juniper Court
  104. Boulder CO 80302
  105. (303) 443 9038
  106. Delphi: DEWI
  107.  
  108.  
  109. -- part contents for background part 7
  110. ----- text -----
  111. Syntax:
  112.  
  113. DeleteFile ("PathName")
  114.  
  115. "PathName" is the full pathname to the file you want to delete.  Do not use quotation marks around it.
  116.  
  117. The result will contain either 
  118. 0 (meaning a successful operation),
  119. 1 (meaning a parameter error), or
  120. a negative number (representing an operating system error).
  121.  
  122. You can use the 'OsErr' function provided in the script of this stack to interpret operating system errors.